package com.zshan.clinic.admin.mapper.clinic;


import com.zshan.clinic.database.model.ClinicEmpRoleRela;
import com.zshan.clinic.database.model.ClinicMenu;
import com.zshan.clinic.database.model.ClinicRoleMenuRela;
import com.zshan.clinic.mybatis.SuperMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface SpecClinicAuthMapper extends SuperMapper {

    /**
     * 根据用户查询权限菜单
     * @param userId
     * @return
     */
    List<ClinicMenu> getMenuListByUserId(@Param("empId") Long userId);

    /**
     * 给用户授权角色
     * @param clinicEmpRoleRelaList
     */
    void authUserRoles(@Param("relaList") List<ClinicEmpRoleRela> clinicEmpRoleRelaList);

    /**
     * 给角色授权菜单
     * @param clinicRoleMenuRelaList
     */
    void authRoleMenus(@Param("relaList") List<ClinicRoleMenuRela> clinicRoleMenuRelaList);

    /**
     * 根据角色ID查询关联的菜单
     * @param roleId
     * @return
     */
    List<Long> getMenuIdListByRole(@Param("clinicId") Long clinicId,
                                   @Param("roleId") Long roleId);
}
